<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Service\FileUploadService;
use Dotenv\Result\Success;
use Exception;
use Illuminate\Http\Request;


class UploadController extends Controller
{

        
    protected $uploadService;

    public function __construct(FileUploadService $uploadService)
    {
        $this->uploadService = $uploadService;
    }

    public function upload(Request $request)
    {
        $folder=$request->input('folder');
        $folder=trim($folder,"/");
        $path = $this->uploadService->uploadFile($folder);
        // 处理成功后的逻辑
        return Success($path);
    }


    public function uploads(Request $request)
    {
        $folder=$request->input('folder');
        $folder=trim($folder,"/");
        $path = $this->uploadService->uploadFiles($folder);
        // 处理成功后的逻辑
        return Success($path);
    }


}
